<template>
<el-select
    v-model="activePage"
    :placeholder="$t('common.please_select')"
    class="percent-w100"
    @change="changeFunc"
    value-key="url"
  >
    <el-option
      v-for="item in pages"
      :key="item.url"
      :value-key="item.name"
      :label="item.name"
      :value="item"
    ></el-option>
  </el-select>
</template>

<script>
export default {
  data() {
    return {
      /*页面数据*/
      pages: [{
        url: "/pages/user/address/address",
        name: $t("common.shipping_address"),
        type: $t("common.menu")
      }, {
        url: "/pages/coupon/coupon",
        name: $t("common.coupon_center"),
        type: $t("common.menu")
      }, {
        url: "/pages/user/my-coupon/my-coupon",
        name: $t("common.my_coupons"),
        type: $t("common.menu")
      }, {
        url: "/pages/agent/index/index",
        name: $t("common.distribution_center"),
        type: $t("common.menu")
      }, {
        url: "/pages/user/my-bargain/my-bargain",
        name: $t("common.my_bargains"),
        type: $t("common.menu")
      }, {
        url: "/pages/shop/index",
        name: $t("common.merchant_management"),
        type: $t("common.menu")
      }, {
        url: "/pages/user/favorite/favorite",
        name: $t("common.my_favorites"),
        type: $t("common.menu")
      }, {
        url: "/pages/order/assemble-order",
        name: $t("common.my_groups"),
        type: $t("common.menu")
      }, {
        url: "/pages/plus/signin/signin",
        name: $t("common.check_in_gift"),
        type: $t("common.menu")
      }, {
        url: "/pages/task/index",
        name: $t("common.task_center"),
        type: $t("common.menu")
      }, {
        url: "/pages/user/evaluate/list",
        name: $t("common.my_reviews"),
        type: $t("common.menu")
      }, {
        url: "/pages/user/set/set",
        name: $t("common.settings"),
        type: $t("common.menu")
      }, {
        url: "scanQrcode",
        name: $t("common.scan"),
        type: $t("common.menu")
      }, {
        url: "/pages/user/my_collect/my_collect",
        name: $t("common.my_following"),
        type: $t("common.menu")
      }],
      /*选中的值*/
      activePage: $t("common.shipping_address")
    };
  },
  created() {
    /*初始化*/
    this.changeFunc(this.pages[0]);
  },
  methods: {
    /*选中的值*/
    changeFunc(e) {
      this.$emit("changeData", e);
    }
  }
};
</script>

